package com.ck.ips.service.impl.report;

import com.ck.core.util.DateUtils;
import com.ck.ips.dao.report.StaticsMapper;
import com.ck.ips.model.vo.statics.DeviceStatusSummaryDailyVO;
import com.ck.ips.service.report.StaticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * @description: StaticsServiceImpl
 * @author: huangf
 * @date: 2019/5/11 10:45
 */
@Service("staticsService")
public class StaticsServiceImpl implements StaticsService {

    @Autowired
    StaticsMapper staticsMapper;


    @Override
    public boolean summaryDeviceStatusYesterday() {
        String yesterday = DateUtils.dateToString(DateUtils.getNextNumDay(new Date(),-1),DateUtils.PATTEN_YMD);
        DeviceStatusSummaryDailyVO deviceStatusSummaryDailyVO = new DeviceStatusSummaryDailyVO(yesterday);
        int effect = staticsMapper.summaryDeviceStatusYesterday(deviceStatusSummaryDailyVO);
        return effect > 0;

    }
}

